<?php
/**
 * Bootstrap implementation for setting things up the app needs to use.
 *
 * @category Zend
 * @package Bootstrap
 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc.
 * @version $Id$
 * @link http://framework.zend.com
 * @since Available since release 1.0
 */

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    /**
     * Generate essential objects
     */
    protected function _initDisputeo()
    {
        Disputeo_Session::begin();
        Disputeo_Acl::build();
        Disputeo_Cache::cache();
    }
    
    /**
     * Register plugin classes
     */
    protected function _initPlugins()
    {
        $front = Zend_Controller_Front::getInstance();
        $front->registerPlugin(new Disputeo_Controller_Plugin_Init())
            ->registerPlugin(new Disputeo_Controller_Plugin_Navigation())
            ->registerPlugin(new Disputeo_Controller_Plugin_Acl());
    }
    
    /**
     * Register helper classes
     */
    protected function _initHelpers()
    {
        $helpers = array(
            new Disputeo_Controller_Action_Helper_Flash()
        );
        
        foreach ($helpers as $helper) {
            Zend_Controller_Action_HelperBroker::addHelper($helper);    
        }
    }
    
    /**
     * Setup routing rules
     */
    protected function _initRoutes()
    {
        $front = Zend_Controller_Front::getInstance();
        $router = $front->getRouter();
        $config = Disputeo_Config::config();
        $router->addConfig($config, 'routes');
    }
}